<template>
	<view :style="[{paddingTop:CustomBar+'px'}]">
		<cu-custom bgColor="bg-colorP" :isBack="true">
			<block slot="backText"></block>
			<block slot="content">招商加盟</block>
		</cu-custom>
		<view class="container" :style="[{height:winHeight+'px'}]">
			<view class="phone-content">
				<image src="https://xarkbucket.oss-cn-hangzhou.aliyuncs.com/%E5%85%8D%E5%8D%95%E9%80%9AApp/3e2634d5123342f24b0bbe6c063a176.png"></image>
				<image src="https://xarkbucket.oss-cn-hangzhou.aliyuncs.com/%E5%85%8D%E5%8D%95%E9%80%9AApp/c35837789f9ea6082392a0a8ac8a614.png"></image>
				<view class="tab-btn bg-colorP" @click='showLayer'>
					<image src="http://xarkbucket.oss-cn-hangzhou.aliyuncs.com/add-phone.png"></image>
					<text>加盟热线</text>
				</view>
			</view>
			<view class="layer" :style="isShow?'display:block;opacity: 1':'display:none;opacity: 0'" @click='hideLayer'></view>
			<view class="layer-content" :style='isShow?"bottom: 0":"bottom: -550rpx"'>
				<view class="title">招商电话</view>
				<view class="phone" v-for="(item,index) in phoneList" :key="index" @tap.stop='goPhone' :data-phone="item.phone">
					<text>{{item.address}}</text>
					<text>{{item.phone}}</text>
				</view>
				<view class="cancle bg-colorP" @click='hideLayer'>取消</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				CustomBar: this.CustomBar,
				winHeight: 0,
				phoneList: [ {
					phone: '13324562580',
					address: '西北招商：'
				}, {
					phone: '13333830518',
					address: '华北招商：'
				}, {
					phone: '17719571235',
					address: '东北招商：'
				}],
				isShow: false
			}
		},
		onLoad() {
			var that = this
			setTimeout(() => {
				uni.getSystemInfo({
					success: function(res) {
						let winHeight = res.windowHeight
						that.winHeight = winHeight - that.CustomBar;
					}
				})
			}, 50)
		},
		methods: {

			showLayer() {
				this.isShow = true
			},

			hideLayer() {
				this.isShow = false
			},

			goPhone(e) {
				uni.makePhoneCall({
					phoneNumber: e.currentTarget.dataset.phone
				})
			},
		}
	}
</script>

<style>
	.container {
		width: 100%;
		overflow-y: scroll;
	}

	.phone-content {
		width: 100%;
		overflow: hidden;
	}

	.phone-content image:nth-child(1) {
		width: 100%;
		height: 400rpx;
	}

	.phone-content image:nth-child(2) {
		width: 100%;
		height: 690rpx;
	}

	.tab-btn {
		width: 280rpx;
		height: 64rpx;
		border-radius: 10rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		text-align: center;
		margin: 10rpx auto;
		color: #fff;
		font-size: 30rpx;
	}

	.tab-btn image {
		width: 32rpx !important;
		height: 32rpx !important;
		margin-right: 20rpx;
	}

	.layer {
		width: 100%;
		height: 100%;
		position: fixed;
		top: 0;
		left: 0;
		background: rgba(0, 0, 0, 0.3);
		transition: all 0.2s;
	}

	.layer-content {
		position: fixed;
		bottom: 0;
		left: 0;
		width: 100%;
		/* height: 300rpx; */
		background-color: #fff;
		border-radius: 10rpx 10rpx 0px 0px;
		display: flex;
		flex-direction: column;
		transition: all 0.2s;
	}

	.layer-content .title {
		height: 88rpx;
		line-height: 88rpx;
		text-align: center;
		border-bottom: solid 1rpx #f2f2f2;
		color: #333;
		font-size: 32rpx;
	}

	.layer-content .phone {
		/* flex: 1; */
		height: 88rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		color: #333;
		font-size: 30rpx;
	}

	.layer-content .cancle {
		height: 88rpx;
		line-height: 88rpx;
		text-align: center;
		border-top: solid 1rpx #f2f2f2;
	}
</style>
